package com.coda.app.mapper;

import com.coda.app.annotation.AutoFill;
import com.coda.entity.UserInfo;
import com.coda.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LoginMapper {
    /**
     * 根据手机号查询用户
     * @param phone
     * @return
     */
    @Select("select * from user_info where phone = #{phone}")
    UserInfo getUserByPhone(String phone);

    /**
     * 新增用户
     * @param userInfo
     */
    @AutoFill(OperationType.INSERT)
    void insert(UserInfo userInfo);

    /**
     * 根据id查询用户
     * @param currentId
     * @return
     */
    @Select("select * from user_info where id = #{currentId}")
    UserInfo getUserInfo(Long currentId);
}
